cmake_minimum_required(VERSION 3.14)

project(qdeb822 LANGUAGES CXX)

set(CMAKE_INCLUDE_CURRENT_DIR ON)

set(CMAKE_AUTOUIC ON)
set(CMAKE_AUTOMOC ON)
set(CMAKE_AUTORCC ON)

set(CMAKE_CXX_STANDARD 11)
set(CMAKE_CXX_STANDARD_REQUIRED ON)

find_package(Qt5 COMPONENTS Core LinguistTools REQUIRED)

set(TS_FILES ${PROJECT_NAME}_zh_CN.ts)

include_directories(Headers)

add_library(${PROJECT_NAME} SHARED qdeb822.cpp)
target_link_libraries(${PROJECT_NAME} Qt5::Core)
set_target_properties(${PROJECT_NAME} PROPERTIES
    SOVERSION 0.1
    PUBLIC_HEADER "Headers/QDeb822;Headers/qdeb822.h")

if(COMMAND qt_create_translation)
    qt_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
else()
    qt5_create_translation(QM_FILES ${CMAKE_SOURCE_DIR} ${TS_FILES})
endif()

include(GNUInstallDirs)
install(TARGETS ${PROJECT_NAME}
    LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
    PUBLIC_HEADER DESTINATION ${CMAKE_INSTALL_INCLUDEDIR}/QDeb822
    )
